package org.example.service;

import org.springframework.data.redis.core.ReactiveRedisTemplate;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

/**
 * TODO 类功能介绍及重点或容易混淆点的说明。
 *
 * @version 1.0 2023/5/20 10:52 龙小南 新建类[说明]
 * @author: 龙小南
 * @Date: 2023/5/20 10:52
 * @Version 1.0[当前版本号]
 */

@Service
public class RedisService {
    private final ReactiveRedisTemplate<String, String> redisTemplate;

    public RedisService(ReactiveRedisTemplate<String, String> redisTemplate) {
        this.redisTemplate = redisTemplate;
    }

    public Mono<String> getValue(String key){
        return redisTemplate.opsForValue().get(key);
    }

    public Mono<Boolean> setValue(String key, String value){
        return redisTemplate.opsForValue().set(key, value);
    }
}
